<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/html/axios.min.js"></script>
    <script src="/html/a.js"></script>
    <style>
        input{
            width: 100px;
        }
    </style>
    <script>
        function $(id) {
            return document.getElementById(id)
        }
        window.onload = function () {
            findByItem(1);
        }
        function findByItem(pageNo) {
            axios.get("/mainPost/findByItem",{
                params:{
                    pageNo:pageNo,
                    channelId:getQuery("id"),
                    theme:$("theme"),
                    author:$("author"),
                    startDate:$("startDate"),
                    endDate:$("endDate")
                }
            }).then(resp=>{
                var str = "";
                var list = resp.data.list;
                list.forEach(e=>{
                    str +=`<tr><td>${e.theme}</td><td>${e.author}</td><td>${e.returnList.size}</td>
                        <td>${e.postDate}</td></tr>`
                });
                $("postContent").innerHTML=str;
                var pageObj = "";
                for (var i=1;i<=resp.data.pages;i++){
                    pageObj += `<a style="margin-left: 10px" href="javascript:findByItem(${i})">${i}</a>`
                    $("pageDiv").innerHTML=pageObj;
                }
            });
        }
    </script>
</head>
<body>
    主题名称：<input type="text" id="theme">
    作者：<input type="text" id="author">
    起始时间：<input type="text" id="startDate">
    结束时间：<input type="text" id="endDate">
    <input type="button" value="搜索" onclick="findByItem()">

    <table border="1px" width="80%" cellspacing="0">
        <thead><tr><th>主题</th><th>作者</th><th>回帖数量</th><th>发帖时间</th></tr></thead>
        <tbody id="postContent"></tbody>
    </table>
    <div id="pageDiv"></div>
</body>
</html>